<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="utf-8" %>
<html>
<head>
    <title>商城首页</title>
    <%@ include file="pages/common/head.jsp" %>
    <script type="text/javascript">
        $(function () {
            //给加入购物车按钮绑定单击事件
            $('button.addToCart').click(function () {
                var goodsId = $(this).attr("id");
                location.href = "http://localhost:8083/shop/cart.do?action=addItem&id=" + goodsId;
            });
        });
    </script>
</head>
<body>

<div id="header">
    <img class="logo_img" alt="" src="static/img/logo.gif">
    <span class="wel_word">网上商城</span>
    <div>
        <c:choose>
            <c:when test="${empty sessionScope.user}">
                <a href="pages/user/login.jsp" class="btn btn-lg btn-info">登录</a> |
                <a href="pages/user/regist.jsp" class="btn btn-lg btn-info">注册</a> &nbsp;&nbsp;
                <a href="pages/manager/manager.jsp" class="btn btn-lg btn-info">后台管理</a>
                <a href="pages/cart/cart.jsp" class="btn btn-lg btn-info">购物车</a>
            </c:when>
            <c:otherwise>
                <%@ include file="pages/user/login_success_menu.jsp" %>
            </c:otherwise>
        </c:choose>


    </div>
</div>
<div id="main">
    <div id="shop">
        <div class="shop_cond">
            <form action="" method="get">
                价格：<input id="min" type="text" name="min" value=""> 元 -
                <input id="max" type="text" name="max" value=""> 元
                <button type="submit" class="btn btn-group-lg btn-primary">查询</button>
            </form>
        </div>
        <div style="text-align: center">
            <span>您的购物车中有3件商品</span>
            <div>
                您刚刚将<span style="color: red">滚筒洗衣机</span>加入到了购物车中
            </div>
        </div>
        <div class="b_list">
            <div class="img_div">
                <img class="shop_img" alt="" src="static/img/default.jpg"/>
            </div>
            <div class="shop_info">
                <div class="shop_name">
                    <span class="sp1">商品名:</span>
                    <span class="sp2">滚筒洗衣机</span>
                </div>
                <div class="shop_author">
                    <span class="sp1">品牌:</span>
                    <span class="sp2">奥利给</span>
                </div>
                <div class="shop_price">
                    <span class="sp1">价格:</span>
                    <span class="sp2">￥500.00</span>
                </div>
                <div class="shop_sales">
                    <span class="sp1">销量:</span>
                    <span class="sp2">230</span>
                </div>
                <div class="shop_amount">
                    <span class="sp1">库存:</span>
                    <span class="sp2">1000</span>
                </div>
                <div class="shop_add">
                    <button class="btn btn-sm btn-info addToCart" id="1">加入购物车</button>
                </div>
            </div>
        </div>

        <div class="b_list">
            <div class="img_div">
                <img class="shop_img" alt="" src="static/img/default.jpg"/>
            </div>
            <div class="shop_info">
                <div class="shop_name">
                    <span class="sp1">商品名:</span>
                    <span class="sp2">滚筒洗衣机</span>
                </div>
                <div class="shop_author">
                    <span class="sp1">品牌:</span>
                    <span class="sp2">奥利给</span>
                </div>
                <div class="shop_price">
                    <span class="sp1">价格:</span>
                    <span class="sp2">￥500.00</span>
                </div>
                <div class="shop_sales">
                    <span class="sp1">销量:</span>
                    <span class="sp2">230</span>
                </div>
                <div class="shop_amount">
                    <span class="sp1">库存:</span>
                    <span class="sp2">1000</span>
                </div>
                <div class="shop_add">
                    <button class="btn btn-sm btn-info">加入购物车</button>
                </div>
            </div>
        </div>

        <div class="b_list">
            <div class="img_div">
                <img class="shop_img" alt="" src="static/img/default.jpg"/>
            </div>
            <div class="shop_info">
                <div class="shop_name">
                    <span class="sp1">商品名:</span>
                    <span class="sp2">滚筒洗衣机</span>
                </div>
                <div class="shop_author">
                    <span class="sp1">品牌:</span>
                    <span class="sp2">奥利给</span>
                </div>
                <div class="shop_price">
                    <span class="sp1">价格:</span>
                    <span class="sp2">￥500.00</span>
                </div>
                <div class="shop_sales">
                    <span class="sp1">销量:</span>
                    <span class="sp2">230</span>
                </div>
                <div class="shop_amount">
                    <span class="sp1">库存:</span>
                    <span class="sp2">1000</span>
                </div>
                <div class="shop_add">
                    <button class="btn btn-sm btn-info">加入购物车</button>
                </div>
            </div>
        </div>

        <div class="b_list">
            <div class="img_div">
                <img class="shop_img" alt="" src="static/img/default.jpg"/>
            </div>
            <div class="shop_info">
                <div class="shop_name">
                    <span class="sp1">商品名:</span>
                    <span class="sp2">滚筒洗衣机</span>
                </div>
                <div class="shop_author">
                    <span class="sp1">品牌:</span>
                    <span class="sp2">奥利给</span>
                </div>
                <div class="shop_price">
                    <span class="sp1">价格:</span>
                    <span class="sp2">￥500.00</span>
                </div>
                <div class="shop_sales">
                    <span class="sp1">销量:</span>
                    <span class="sp2">230</span>
                </div>
                <div class="shop_amount">
                    <span class="sp1">库存:</span>
                    <span class="sp2">1000</span>
                </div>
                <div class="shop_add">
                    <button class="btn btn-sm btn-info">加入购物车</button>
                </div>
            </div>
        </div>
    </div>

    <div id="page_nav">
        <a href="#">首页</a>
        <a href="#">上一页</a>
        <a href="#">3</a>
        【4】
        <a href="#">5</a>
        <a href="#">下一页</a>
        <a href="#">末页</a>
        共10页，30条记录 到第<input value="4" name="pn" id="pn_input"/>页
        <button class="btn btn-sm btn-default">确定
        </button>
    </div>

</div>
<%@include file="pages/common/foot.jsp" %>
</body>
</html>
